//  @ Project : GagalPanen
//  @ File Name : plant.hpp
//  @ Date : 3/9/2011
//  @ Author : 
//
//


#if !defined(_PLANT_H)
#define _PLANT_H

#include "standingstillcreature.hpp"
#include "fruit.hpp"
#include "plantform.hpp"
#include "plantablecell.hpp"

class Plant : public StandingStillCreature {
public:

  // normal constructor
  Plant(GameInterface* game, PlantableCell* cell, int plant_id);

  // load game constructor
  Plant(GameInterface* game, std::ifstream& is);

  virtual void save(std::ofstream& os);

  virtual ~Plant();

  /*
   Harvest works as follows
   First time, it grows from seed to plant in getPlantMatureTime() days,
   Then, it grows from plant to fruit in getPlantRipeTime() days.
   If it is a multiple harvest plant, it regrows in getPlantRipeTime(),
   increased by getPlantRipeTime() for each harvest.
   Otherwise the plant simply deletes itself*/
  Fruit* harvest();
  bool isHarvestable();
  void advanceDay();
  void advanceTime();
  bool isDead();
  bool isMature();
  bool isSeed();
  bool isSteppable();
  int getId();
  Fruit* getFruit();

  void makeDead();
  void makeHarvestable();
  void restartToSeed();
protected:

  /*
   * Happiness is the measure of age for the plant
   */
  int getHappiness();
private:
  int happiness_;
  int plant_id_;
  int harvest_count_;
  int total_happiness_;
  int age_;

  /*
   Form of the plant, that is, either seed or mature.*/
  PlantForm form_;
};

#endif  //_PLANT_H
